package org.flowable.listener;

import org.flowable.engine.delegate.TaskListener;
import org.flowable.task.service.delegate.DelegateTask;

/**
 * @author yuwl
 * @description 自定义监听器 任务分配-流程变量-监听器分配
 * @since 2024-02-01 14:36
 */
public class MyTaskListener implements TaskListener {
    @Override
    public void notify(DelegateTask delegateTask) {
        System.out.println("监听器触发了: " + delegateTask.getName());
        if ("提交请假流程".equals(delegateTask.getName())
            && "create".equals(delegateTask.getEventName())) {
            delegateTask.setAssignee("小明");
        } else {
            delegateTask.setAssignee("小张");
        }
    }
}
